package com.genesis.yunnanji.view;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.genesis.yunnanji.R;
import com.youth.xframe.widget.XStateButton;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建日期：2018/9/21 on 14:48
 * 作者:Kite
 * 描述:是否绑定成功
 */
public class IsBindingSuccessActivity extends BaseActivity {

    @BindView(R.id.tv_success)
    TextView tvSuccess;

    @BindView(R.id.xsb_success)
    XStateButton xsbSuccess;

    @BindView(R.id.ll_success)
    LinearLayout llSuccess;

    @BindView(R.id.ll_failure)
    LinearLayout llFailure;

    @BindView(R.id.tv_failure)
    TextView tvFailure;

    @BindView(R.id.xsb_failure)
    XStateButton xsbFailure;

    private boolean isBindingSuccess = true;

    @Override
    public int getLayoutId() {
        return R.layout.activity_is_binding_success;
    }

    @Override
    public void initView() {
        super.initView();
        int type = getIntent().getIntExtra("p0", 0);
        switch (type) {//0绑定手机，1绑定邮箱，2修改绑定手机，3修改绑定邮箱,4修改密码
            case 0:
                setTitle("绑定手机");
                break;
            case 1:
                setTitle("绑定邮箱");
                break;
            case 2:
                setTitle("修改绑定手机");
                break;
            case 3:
                setTitle("修改绑定邮箱");
                break;
            case 4:
                setTitle("修改密码");
                break;
        }
        isBindingSuccess();
    }

    @OnClick({R.id.xsb_success, R.id.xsb_failure})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.xsb_success:
                advance(HomePageActivity.class);
                break;
            case R.id.xsb_failure:
                finish();
                break;
        }
    }

    private void isBindingSuccess() {
        if (isBindingSuccess) {
            llSuccess.setVisibility(View.VISIBLE);
            llFailure.setVisibility(View.GONE);
        } else {
            llSuccess.setVisibility(View.GONE);
            llFailure.setVisibility(View.VISIBLE);
        }
    }

}
